import store from "@/store";
import dayjs from 'dayjs';
console.log(88);
export const formItemStyle = {
  paddingLeft: "20px",
};

export const cellStyle = {
  background: "rgba(28, 155, 252, 0.02)",
  color: "rgb(142, 155, 185)",
  textAlign: "center",
};

// 表头单元格样式
export const headerCellStyle = {
  background: "rgba(28, 155, 252, 0.02)",
  color: "rgb(142, 155, 185)",
  textAlign: "center",
};

// 表格内表单子样式
export const tableFormStyle = {
  marginBottom: 0,
};


export const formBase = [ 
  {
    label: '时间类型',
    type: 'select',
    field: 'dateType',
    optionsKey: 'label',
    optionsValue: 'value',
    options: [
      {
        label: '获得时间',
        value: 1
      }, {
        label: '使用时间',
        value: 2
      },
      {
        label: '过期时间',
        value: 3
      }
    ],
  }, 
  {
    label: '时间',
    type: 'daterange',
    field: 'shelfTime',
    prop: 'shelfTime',
    required: true,
    otherOptions: {
      disabled: false,
      rangeSeparator: '至',
      startPlaceholder: '开始日期',
      endPlaceholder: '结束日期',
      pickerOptions: {
        shortcuts: [ {
          text: "今天",
          onClick(picker) {
            const end = dayjs().format("YYYY-MM-DD 23:59:59");
            const start = dayjs().format("YYYY-MM-DD 00:00:00");
            picker.$emit("pick", [start, end]);
          },
        },
        {
          text: "昨天",
          onClick(picker) {
            const end = new Date(dayjs().format("YYYY-MM-DD 23:59:59"));
            const start = new Date(dayjs().format("YYYY-MM-DD 00:00:00"));
            end.setTime(start.getTime() - 3600 * 1000 * 24);
            start.setTime(start.getTime() - 3600 * 1000 * 24);
            picker.$emit("pick", [start, end]);
          },
        },
        {
          text: "最近三天",
          onClick(picker) {
            const end = new Date(dayjs().format("YYYY-MM-DD 23:59:59"));
            const start = new Date(dayjs().format("YYYY-MM-DD 00:00:00"));
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 3);
            picker.$emit("pick", [start, end]);
          },
        },
        {
          text: "最近一周",
          onClick(picker) {
            const end = new Date(dayjs().format("YYYY-MM-DD 23:59:59"));
            const start = new Date(dayjs().format("YYYY-MM-DD 00:00:00"));
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
            picker.$emit("pick", [start, end]);
          },
        },
        {
          text: "最近一个月",
          onClick(picker) {
            const end = new Date(dayjs().format("YYYY-MM-DD 23:59:59"));
            const start = new Date(dayjs().format("YYYY-MM-DD 00:00:00"));
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
            picker.$emit("pick", [start, end]);
          },
        },]
      }
    }
  }, 
  { 
    label: "会员ID",
    type: "input", 
    field: "userId",
  },  
  { 
    label: "会员名",
    type: "input", 
    field: "userName",
  },  
  {
    label: '赠送类型',
    type: 'select',
    field: 'grantType',
    optionsKey: 'label',
    optionsValue: 'value',
    options: [
      {
        label: '注册赠送',
        value: 0
      }, 
      {
        label: '后台赠送',
        value: 1
      }
    ],
  }, 
  { 
    label: "面额",
    type: "input", 
    field: "denomination",
  }, 
  {
    label: '状态',
    type: 'select',
    field: 'status',
    optionsKey: 'label',
    optionsValue: 'value',
    options: [
      {
        label: '未过期',
        value: 0
      }, {
        label: '已过期',
        value: 1
      }, 
    ],
  },  
];

export const tableBase = [
  {
    label: "编号",
    prop: "id", 
    width: "200", 
  },  
  {
    label: "订单编号",
    prop: "orderNo", 
    width: "200", 
  },  
  {
    label: "会员ID",
    prop: "userId", 
    width: "200", 
  },  
  {
    label: "会员昵称",
    prop: "userName", 
    width: "200", 
  },  
  {
    label: "面额",
    prop: "denomination", 
    width: "200", 
    slotName: 'denomination'
  },  
  {
    label: "优惠券类型",
    prop: "couponType", 
    width: "200", 
    slotName: 'couponType'
  },  
  {
    label: "领取时间",
    prop: "receiveDate", 
    width: "200", 
  },  
  {
    label: "使用时间",
    prop: "useDate", 
    width: "200", 
  }, 
  {
    label: "发放类型",
    prop: "grantType", 
    width: "200", 
    slotName: 'grantType'
  },  
  {
    label: "备注",
    prop: "remark", 
    width: "200", 
  },  
  {
    label: "是否已过期",
    prop: "status", 
    width: "200", 
    slotName: 'status'
  },  
  {
    label: "是否已使用",
    prop: "isUsed", 
    width: "200", 
    slotName: 'isUsed'
  },  
  {
    label: "过期时间",
    prop: "expireDate", 
    width: "200", 
  },  
  {
    label: "操作电脑IP",
    prop: "grantIp", 
    width: "200", 
  },  
  {
    label: "集运券有效时长",
    prop: "effectiveDuration", 
    width: "200", 
  },   
];
 
